package com.bdqn.t320.ch06.repository;

import com.bdqn.t320.ch06.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

public interface UserRepository  extends JpaRepository<User,Long>,JpaSpecificationExecutor<User> {

    public List<User> findByUsrName(String usrName);

//    @Query(value="select u from User u where u.usrRoleId=?1",nativeQuery = false)
//    public List<User> findByaaRoleId(Long roleId);
//
//    @Query(value = "select * from sys_user where usr_role_id=?1",nativeQuery = true)
//    public List<User> findByRoleId(Long roleId);
//
//    @Query("select u from User u where u.usrRoleId=?1")
//    public Page<User> findPageByUsrRoleId(Long roleId, Pageable pageable);

   // public Page<User> findPageByMap(Map param, Pageable pageable);

//    @Query("select u.usrId as usrId, u.usrName as usrName, u.usrPassword as usrPassword, " +
//            "u.usrRoleId as usrRoleId, u.usrFlag as usrFlag, r.roleName as roleName " +
//            "from User u, Role r where u.usrRoleId=r.roleId and u.usrId=?1")
//    public UserInfo getUserInfo(Long usrId);
}
